<?php
namespace common\repositories\myhtsq;

use common\entities\myhtsq\ContractSupplierEntity;
use common\repositories\BaseRepository;
use common\support\Helper;

class ContractSupplierRepository extends BaseRepository
{
    /**
     * 构造方法
     * @param unknown $config (optional)
     */
    public function __construct($config = [])
    {
        parent::__construct($config);
    }

    public static function getSupplierNameLists()
    {
        return ContractSupplierEntity::find()->select('company_name')->asArray()->all();
    }

    public static function getSupplierInfoByName($supplier_name = '')
    {
        if (empty($supplier_name)) {
            return [];
        }

        return ContractSupplierEntity::find()->where(['company_name' => $supplier_name])->asArray()->one();
    }
}